#include "formlog.h"
#include "ui_formlog.h"

#include "log.h"

FormLog::FormLog(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::FormLog)
{
    ui->setupUi(this);
}

void FormLog::out(LogOut level, QString msg)
{
    QString m = trUtf8("<em>%1</em> %2").
            arg(Log::getTypeName(level)).arg(msg);
    ui->textLog->append(m);
}

void FormLog::out(LogOut level, QString module, QString msg)
{
    if (level == ODEBUG){
        QString m = trUtf8("<em>%1</em> %2: %3").
                arg(Log::getTypeName(level)).arg(module).arg(msg);

        /* Co/Décommenté pour cacher/afficher les traces debug dans l'interface  */
        //ui->textLog->append(m);

    }else{
        out(level, msg);
    }
}

FormLog::~FormLog()
{
    delete ui;
}
